Skip to content

fix(antigravity-acp): add installCheck smoke check for patchelf-rewritten binaries (#4759) - #5337

Merged
dezren39 merged 2 commits into
mainfrom
queue/7584-4759-patchelf-audit
Nov 4, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/7584-4759-patchelf-audit

Conversation

@dezren39

@dezren39 dezren39 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Fixes #4759

What

Adds the missing runtime smoke check to pkgs/antigravity-acp, the one gap found by the #4759 audit of every fleet derivation that autoPatchelfHook rewrites on the current nixpkgs pin (full audit recorded on #4759).

agy_acp_server.par is a dynamically linked single-file PAR executable — exactly the shape patchelf 0.19.x corrupts (the t3 Node SEA segfault, #4884) — and the derivation had no installCheck at all. The new check:

  • executes localharness_external --help (Go binary; usage exit 2 accepted, a SIGSEGV/139 fails), and
  • verifies agy_acp_server.par's ELF loading path via the dynamic linker's --list mode (patched interpreter + RUNPATH resolution). The .par cannot execute inside the build sandbox — its tcmalloc startup aborts on the sandbox's restricted CPU view (third_party/tcmalloc NumCPUs CHECK) before main — but the patchelf 0.19.x corrupts Node SEA binaries (t3 0.1.2 segfaults; blocked the fleet switch) #4759 failure mode segfaulted inside ld.so before main too, so the loading path is the part a check can and must cover in-sandbox. On a host the built .par starts and answers --help.

Everything else the audit covered (latest-cli's turso-cli/tursodb, claude-code, jules, mojo, t3) already has an executing installCheck; antigravity-hub (Electron) is reviewed and exempt — see the audit comment on #4759.

Verification

  • Laptop build of the modified derivation against the flake's pinned nixpkgs: green, installCheckPhase ran (drv /nix/store/9qfp4x98gvirg24lak7bdpspii892nmg-antigravity-acp-1.2.1.drv).
  • Built output on the host: agy_acp_server.par --help prints its flags; localharness_external --help prints usage.
  • Queue task 7584 (repo-health-code-pilot), lane code-s.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 4, 2026 07:16
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8f6b0a78-57f7-48a4-a1a3-18088c33f4b7
Commits

Reviewing files that changed from the base of the PR and between 8bb1e43 and 5ca0be7.

Files selected for processing: 1
  • pkgs/antigravity-acp/default.nix
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T08:25:38.265975Z 5ca0be7 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0dcae8db3f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkgs/antigravity-acp/default.nix Outdated
# main ever ran -- so verify that path through the dynamic linker's
# --list mode, which resolves the patched interpreter and RUNPATH
# without running program initializers.
"${stdenv.cc.bintools.dynamicLinker}" --list "$out/bin/agy_acp_server.par" > /dev/null

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Inspect the PAR payload instead of the generated wrapper

On Linux, this checks the generated launcher rather than the patchelf-rewritten PAR executable. The existing postFixup calls wrapProgram, whose implementation moves the original executable to .agy_acp_server.par-wrapped and replaces its public path with a compiled launcher. The local dynamic linker's --help describes --list as “list all dependencies and how they are resolved”; it does not execute the launcher and therefore never reaches the PAR payload. Consequently, this check can pass even when that payload has the loader corruption it is intended to detect. Inspect the hidden wrapped executable, or perform this check before wrapping.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disposition from queue task 7584 (lane code-w), 2026-11-04: accepted as a real gap — the installCheck must reach the patchelf-rewritten PAR payload (the hidden .agy_acp_server.par-wrapped executable), not only the generated launcher. Not fixed in this pass: task 7584 is parked with this finding named as the blocker so the fix lands as a deliberate follow-up push on this branch rather than being merged past. Do not merge until this thread is resolved by a fix or a reasoned rebuttal.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5ca0be7 (queue task 7584, lane code-x): the installCheck now runs the dynamic linker's --list against the hidden patchelf-rewritten payload $out/bin/.agy_acp_server.par-wrapped, not the makeBinaryWrapper launcher at the public path. Verified by evaluating the derivation on x86_64-linux: the rendered installCheckPhase contains ld-linux-x86-64.so.2 --list "$out/bin/.agy_acp_server.par-wrapped".

Comment thread pkgs/antigravity-acp/default.nix Outdated
# main ever ran -- so verify that path through the dynamic linker's
# --list mode, which resolves the patched interpreter and RUNPATH
# without running program initializers.
"${stdenv.cc.bintools.dynamicLinker}" --list "$out/bin/agy_acp_server.par" > /dev/null

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict the ELF loader check to Linux

On the explicitly supported aarch64-darwin platform, this mandatory check attempts to execute /usr/lib/dyld --list ...: the Nixpkgs bintools wrapper selects /usr/lib/dyld as Darwin's dynamic linker. Unlike Linux's loader, dyld cannot be invoked this way; Apple's Mach-O loader rejects direct execution of MH_DYLINKER with LOAD_FAILURE when depth != 2. Consequently, the new unconditional install check breaks Darwin builds independently of whether the packaged binaries are healthy. Guard this ELF-specific command with stdenv.hostPlatform.isLinux, matching the existing platform restriction on autoPatchelfHook, or provide a separate Darwin check.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disposition from queue task 7584 (lane code-w), 2026-11-04: accepted as a real gap — the ELF loader check must be guarded to Linux (stdenv.hostPlatform.isLinux); as written it would break the supported aarch64-darwin build. Not fixed in this pass: task 7584 is parked with this finding named as the blocker so the fix lands as a deliberate follow-up push on this branch rather than being merged past. Do not merge until this thread is resolved by a fix or a reasoned rebuttal.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5ca0be7 (queue task 7584, lane code-x): the ELF loader check is now wrapped in lib.optionalString stdenv.hostPlatform.isLinux, so Darwin builds no longer attempt to execute /usr/lib/dyld --list. Verified by evaluating the derivation for aarch64-darwin: the rendered installCheckPhase contains no --list command (the Linux evaluation still contains it, against the wrapped payload).

@dezren39

dezren39 commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

🤖 Agent note · handed off (task 9305)

Claimed by lane code-h and assigned to the opencode execution lane (§1b) — handed to the bound opencode claimant session for the follow-up disposition itself; the sandbox lane does not work this task itself.

Revalidation leads for the claimant (fresh gh checks at handoff, 2026-11-04 — re-verify before acting):

@dezren39
dezren39 merged commit a133165 into main Nov 4, 2026
1 of 2 checks passed
@dezren39
dezren39 deleted the queue/7584-4759-patchelf-audit branch November 4, 2026 10:40
@dezren39
dezren39 restored the queue/7584-4759-patchelf-audit branch November 8, 2026 04:24
@dezren39
dezren39 deleted the queue/7584-4759-patchelf-audit branch November 8, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

patchelf 0.19.x corrupts Node SEA binaries (t3 0.1.2 segfaults; blocked the fleet switch)

1 participant